package com.rwx.reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;

public class Reflect08 {

    public static void main(String[] args) throws ClassNotFoundException,
            NoSuchMethodException,
            InvocationTargetException,
            InstantiationException, IllegalAccessException, NoSuchFieldException {

        ArrayList<Integer> list = new ArrayList<>();
        list.add(123);

        Class<? extends ArrayList> clazz = list.getClass();
        Method add = clazz.getMethod("add", Object.class);
        add.invoke(list,"qwq");

        System.out.println(list);


        System.out.println("=============================");
    }
}
